home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UCRASM25.ARJ / TESTRAND.ASM < prev    next >
Assembly Source File  |  1991-10-24  |  2KB  |  134 lines

  1.         include        stdlib.a
  2.         includelib     stdlib.lib
  3. ;
  4. lesi        macro    adrs
  5.         mov     di, seg adrs
  6.         mov    es, di
  7.         lea    di, adrs
  8.         endm
  9. ;
  10. ldxi        macro    adrs
  11.         mov    dx, seg adrs
  12.         lea    si, adrs
  13.         endm
  14. ;
  15. ;****************************************************************************
  16. ;
  17. ; T  E  S  T       S  U  I  T  E      F  O  R
  18. ;
  19. ;
  20. ; R  A  N  D  Y      H  Y  D  E ' S     S  T  A  N  D  A  R  D
  21. ;
  22. ; L  I  B  R  A  R  Y     F  O  R     A  S  S  E  M  B  L  Y
  23. ;
  24. ; L  A  N  G  U  A  G  E     P  R  O  G  R  A  M  M  E  R  S
  25. ;
  26. ;****************************************************************************
  27. ;
  28. ;
  29. ; Global variables go here:
  30. ;
  31. dseg        segment    para public 'data'
  32. i        dw    ?
  33. j        dw    ?
  34. k        dw    ?
  35. dseg        ends
  36. ;
  37. ;
  38. dseg        segment    para public 'data'
  39. ;
  40. MemAvail    dw    ?
  41. ;
  42. dseg        ends
  43. ;
  44. ;
  45. ;
  46. ;
  47. cseg        segment    para public 'code'
  48.         assume    cs:cseg, ds:dseg
  49. ;
  50. ;
  51. ;
  52. ;
  53.         public    PSP
  54. PSP        dw    ?
  55. ;
  56. cr        equ    13
  57. lf        equ    10
  58. ;
  59. ;
  60. ; Main is the main program.  Program execution always begins here.
  61. ;
  62. Main        proc
  63.         mov    cs:PSP, es        ;Save pgm seg prefix
  64.         mov    ax, seg dseg        ;Set up the segment registers
  65.         mov    ds, ax
  66.         mov    es, ax
  67.         mov    dx, 0            ;Allocate all available RAM.
  68.         MemInit
  69.         mov    MemAvail, cx
  70.         printf
  71.         db    "There are %x paragraphs of memory available."
  72.         db    cr,lf,lf,0
  73.         dd    MemAvail
  74. ;
  75. ;
  76. ;
  77. ;
  78. ;***************************************************************************
  79. ;
  80. ; Test the random number generator:
  81. ;
  82.         mov    k, 3
  83. loop0:        mov    i, 20
  84. loop1:        mov    j, 12
  85. loop2:        random
  86.         mov    cx, 6
  87.         putusize
  88.         dec    j
  89.         jnz    loop2
  90.         putcr
  91.         dec    i
  92.         jnz    loop1
  93.         print
  94.         db    "Press any key to continue:",0
  95.         getc
  96.         print
  97.         db    "...randomizing...",cr,lf,lf,0
  98.         randomize
  99.         dec    k
  100.         jnz    loop0
  101. ;
  102. ;
  103. ;***************************************************************************
  104. ;
  105. ;
  106. ;
  107. Quit:        mov     ah, 4ch
  108.         int     21h
  109. ;
  110. ;
  111. Main        endp
  112. ;
  113. ;
  114. ;
  115. ;
  116. cseg            ends
  117. ;
  118. ;
  119. ; Allocate a reasonable amount of space for the stack (2k).
  120. ;
  121. sseg        segment    para stack 'stack'
  122. stk        db    256 dup ("stack   ")
  123. sseg        ends
  124. ;
  125. ;
  126. ;
  127. ; zzzzzzseg must be the last segment that gets loaded into memory!
  128. ;
  129. zzzzzzseg    segment    para public 'zzzzzz'
  130. LastBytes    db    16 dup (?)
  131. heap        db    1024 dup (?)
  132. zzzzzzseg    ends
  133.         end    Main
  134.